﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.PointOfService;

namespace POS
{
    class StaticProperties
    {
        public static double TimeToUpdate { get; set; }
        public static int ReceiptNo { get; set; }
        public static string TableName { get; set; }
        public static string ServerName { get; set; }
        public static int ServerID { get; set; }
        public static List<string> EmployeeNamesList = new List<string>();

        public static int StartingReceiptNo { get; set; }

        public static string ReceiptNoGenerator ()
        {
            DateTime date = DateTime.Now;
            double datetoOADate = date.ToOADate();


            int i = (int)Math.Truncate(date.ToOADate());

            string ReceiptNumberCombo = i.ToString() + StartingReceiptNo.ToString();
            StartingReceiptNo++;

            return ReceiptNumberCombo;
        }

        public static bool checkLogin(int UserName, int Password)
        {
            foreach (DataRow row in DataTableClass.EmployeeLogin.Rows) // Loop over the rows.
            {
                if ((row["EmployeeID"].ToString().Trim() == UserName.ToString()) && (row["EmployeePassword"].ToString().Trim() == Password.ToString()))
                {

                    ServerName = row["EmployeeFullName"].ToString().Trim();
                    ServerID = (int)row["EmployeeID"];

                    return true;
                }
            }

            return false;
        }

        public static int GetEmployeeID(string EmployeeName)
        {
            foreach (DataRow row in DataTableClass.EmployeeLogin.Rows) // Loop over the rows.
            {
                if (row["EmployeeName"].ToString().Trim() == EmployeeName)
                {
                    ServerName = row["EmployeeName"].ToString().Trim();
                    ServerID = (int)row["EmployeeID"];

                    return (int)row["EmployeeID"];
                }
            }

            return 0;
        }

        public static void GetEmployeeNameList()
        {
            EmployeeNamesList.Clear();

            foreach (DataRow row in DataTableClass.EmployeeLogin.Rows) // Loop over the rows.
            {
                EmployeeNamesList.Add((row["EmployeeFullName"].ToString().Trim()));
            }
        }

        public static Msr CreditCardReader;
        public static PosPrinter StationPrinter;

    }
}
